module datetime has no attribute strptime

81

module 'datetime' has no attribute 'strptime' -

Use this: from datetime import datetime
instead of Import datetime

AttributeError: 'module' object has no attribute 'strptime' -

# import datetime module
import datetime

start_date = "2022-05-06"

# convert into datetime object and print
print(datetime.datetime.strptime(start_date, "%Y-%m-%d"))

Comments

Submit
0 Comments